home *** CD-ROM | disk | FTP | other *** search
/ The Best of MacTutor - S…e Code for Volumes 1 to 5 / The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin / Source Code / #48 (Sep 89) / Zoundz Source / About.Pas next >
Pascal/Delphi Source File  |  1989-05-08  |  1KB  |  66 lines

  1. unit About;
  2.  
  3. interface
  4.  
  5.     procedure D_About;
  6.  
  7. implementation
  8.  
  9.     const                               {These are the item numbers for controls in the Dialog}
  10.         I_OK = 1;
  11.         I_x = 2;
  12.         I_x3 = 3;
  13.     var
  14.         ExitDialog: boolean;
  15.         DoubleClick: boolean;
  16.         MyPt: Point;
  17.         MyErr: OSErr;
  18.  
  19.     procedure D_About;
  20.         var
  21.             GetSelection: DialogPtr;
  22.             tempRect: Rect;
  23.             DType: Integer;
  24.             DItem: Handle;
  25.             itemHit: Integer;
  26.  
  27.         procedure Refresh_Dialog;
  28.             var
  29.                 rTempRect: Rect;
  30.  
  31.         begin
  32.             SetPort(GetSelection);
  33.             GetDItem(GetSelection, I_OK, DType, DItem, tempRect);
  34.             PenSize(3, 3);
  35.             InsetRect(tempRect, -4, -4);
  36.             FrameRoundRect(tempRect, 16, 16);
  37.             PenSize(1, 1);
  38.  
  39.         end;
  40.  
  41.     begin
  42.         GetSelection := GetNewDialog(2, nil, Pointer(-1));
  43.         tempRect := GetSelection^.portRect;
  44.         tempRect.Top := ((screenBits.Bounds.Bottom - screenBits.Bounds.Top) - (tempRect.Bottom - tempRect.Top)) div 2;
  45.         tempRect.Left := ((screenBits.Bounds.Right - screenBits.Bounds.Left) - (tempRect.Right - tempRect.Left)) div 2;
  46.         MoveWindow(GetSelection, tempRect.Left, tempRect.Top, TRUE);
  47.         ShowWindow(GetSelection);
  48.         SelectWindow(GetSelection);
  49.         SetPort(GetSelection);
  50.         Refresh_Dialog;
  51.         ExitDialog := FALSE;
  52.  
  53.         repeat
  54.             ModalDialog(nil, itemHit);
  55.             GetDItem(GetSelection, itemHit, DType, DItem, tempRect);
  56.             if (ItemHit = I_OK) then{Handle the Button being pressed}
  57.                 begin
  58.                     ExitDialog := TRUE;{Exit the dialog when this selection is made}
  59.                 end;
  60.  
  61.         until ExitDialog;
  62.         DisposDialog(GetSelection);
  63.  
  64.     end;
  65.  
  66. end.                                {End of unit}